//#define __DEBUG__
// by Xeno
#define THIS_FILE "fn_dirto2x.sqf"
#include "x_setup.sqf"

private ["_pos1","_pos2"];
PARAMS_2(_pos1,_pos2);

if (typename _pos1 == "OBJECT") then {_pos1 = getpos _pos1};
if (typename _pos2 == "OBJECT") then {_pos2 = getpos _pos2};

((_pos2 select 0) - (_pos1 select 0)) atan2 ((_pos2 select 1) - (_pos1 select 1))